import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 8/25/13
 * Time: 2:30 PM
 * To change this template use File | Settings | File Templates.
 */
public class ScoreInterface {
    private ScoreProcessor scoreProcessor;
    private PrintStream printStream;


    public ScoreInterface(ScoreProcessor scoreProcessor, PrintStream printStream) {
        this.scoreProcessor = scoreProcessor;
        this.printStream = printStream;
    }

    public boolean canDeclareWinner() {
        String player = this.returnWinner();
        if (this.returnWinner() == null)
        {
            return false;
        }
        else {
            printStream.println("Winner! " + player);
            return true;
        }
    }

    public String returnWinner() {
        return scoreProcessor.getWinningPlayer();
    }

    public void run() {
        printStream.println("Enter Player (1 or 2) that scored:");
        int input = scoreProcessor.processUserInput();
        scoreProcessor.processScore(input);
    }

    public void printScores() {
        printStream.println(scoreProcessor.interpretScore());
    }


}
